<?php
namespace xmi_shop\api;
use xmi_shop\controller;
use xmi_shop\model\categoryModel;
use xmi_shop\model\settingModel;
class home extends controller{


    public function index(){

        $category = new categoryModel();
//        $cat = $category->get_list();
        $cat = $category->tree();

        echo json_encode( $cat );
    }

    public function setting(){
        $shop_name = settingModel::get('config','shop_name');
        $home_live_show = settingModel::get('config','home_live_show');

        $json = [
            'status'=>0,
            'settings'=>[
                'shop_name'     => !empty($shop_name)?$shop_name['value']:'',
                'home_live_show'=> !empty($home_live_show)? intval( $home_live_show['value'] ):1,
            ]
        ];

        echo json_encode( $json );
    }


}
